$(function () {

    // 隱藏側邊欄
    $('#LAY_app_flexible').click(function () {
        var $this = $(this);

        if ($this.is('.layui-icon-shrink-right')) {
            $this.removeClass('layui-icon-shrink-right').addClass('layui-icon-spread-left');
            $('.layui-side').hide();
            $('.layui-body').css({
                left: 0
            });
        } else {
            $this.removeClass('layui-icon-spread-left').addClass('layui-icon-shrink-right');
            $('.layui-side').show();
            $('.layui-body').css({
                left: '200px'
            });
        }
    });

    if ($('div.layui-side-scroll').length) {
        $('div.layui-side-scroll').scroll(function () {
            Cookies.set('layui-side-scroll-top', $(this).scrollTop());
        });

        $('div.layui-side-scroll').animate({
            scrollTop: Cookies.get('layui-side-scroll-top')
        }, 500);
    }
});
